package day11.packet;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

/**
 * @author chenshijie
 * @date 2023/12/22 15:36
 */
@Data
public abstract class Packet {
    /**
     * 协议版本
     */
    private Byte version = 1;

    public static final int SUCCESS = 1;
    public static final int FAIL = 0;

    public void setSuccess() {
        this.status = 1;
    }

    public void setFail() {
        this.status = FAIL;
    }

    public boolean isSuccess() {
        return this.status == SUCCESS;
    }

    private int status;

    public abstract Byte getCommand();

    private String message;
}
